#define _CRT_SECURE_NO_WARNINGS 1

class OrderedStream {
public:
    OrderedStream(int n) {
        _stor = vector<string>(n);
        _ptr = 0;
    }

    vector<string> insert(int idKey, string value) {
        vector<string> res;
        _stor[idKey - 1] = value;
        while (_ptr < _stor.size() && _stor[_ptr] != "")
        {
            res.push_back(_stor[_ptr++]);
        }
        return res;
    }
    int _ptr;
    vector<string> _stor;
};

/**
 * Your OrderedStream object will be instantiated and called as such:
 * OrderedStream* obj = new OrderedStream(n);
 * vector<string> param_1 = obj->insert(idKey,value);
 */